# This sample code uses the Appium python client
# pip install Appium-Python-Client
# Then you can paste this into a file and simply run with Python

from appium import webdriver

caps = {}
caps["platformName"] = "Android"
caps["platformVersion"] = "4.3"
caps["deviceName"] = "emulator-5554"
caps["browserName"] = ''
caps["app"] = "D:\\Apps\\ContactManager.apk"

driver = webdriver.Remote("http://127.0.0.1:4723/wd/hub", caps)

el1 = driver.find_element_by_accessibility_id("Add Contact")
el1.click()
el2 = driver.find_element_by_id("com.example.android.contactmanager:id/contactNameEditText")
el2.click()
el2.send_keys("woniuxy")
el3 = driver.find_element_by_id("com.example.android.contactmanager:id/contactPhoneEditText")
el3.click()
el3.send_keys("123456")
el4 = driver.find_element_by_id("com.example.android.contactmanager:id/contactEmailEditText")
el4.click()
el4.send_keys("ccsensei@woniuxy.com")
el5 = driver.find_element_by_accessibility_id("Save")
el5.click()

driver.quit()